<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<!DOCTYPE html>
<html lang="zh-cn">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="renderer" content="webkit">
  <title></title>
  <link rel="stylesheet" href="../css/pintuer.css">
  <link rel="stylesheet" href="../css/admin.css">
  <script src="../js/jquery.js"></script>
  <script src="../js/pintuer.js"></script>
  </head>
  <body>
    <div class="panel admin-panel">
      <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加学生信息</strong></div>
      <div class="body-content">
        <div class="form-x">
          <div class="form-group" >
            <div class="label">
              <label>学号：</label>
            </div>
            <div class="field">
              <input type="text" class="input w50" style="width: 300px;" id="id" name="id" data-validate="required:请输入学生学号" />
              <div class="tips"></div>
            </div>
          </div>
          <div class="form-group">
            <div class="label">
              <label>姓名：</label>
            </div>
            <div class="field">
              <input type="text" id="name" name="name" class="input" style="width:300px; float:left;"  value=""  data-toggle="hover" data-place="right" data-validate="required:请输入学生姓名"/>
            </div>
          </div>
          <div class="form-group">
            <div class="label">
              <label>性别：</label>
            </div>
            <div class="field">
              <select id="sex" name="sex" class="input w50" style="width: 300px;">
                <option value="0">男</option>
                <option value="1">女</option>
              </select>
            </div>
          </div>
          <div class="form-group" >
            <div class="label">
              <label>年龄：</label>
            </div>
            <div class="field">
              <input type="number" id="age" name="age" class="input" style="width:300px; float:left;"  value=""  data-toggle="hover" data-place="right" data-validate="required:请输入学生年龄" />
            </div>
          </div>
          <div class="form-group" >
            <div class="label">
              <label>班级：</label>
            </div>
            <div class="field">
              <input type="text" class="input w50" style="width: 300px;" value="" id="studentclass" name="studentclass" data-validate="required:请输入学生所在班级" />
              <div class="tips"></div>
            </div>
          </div>
          <div class="form-group" style="margin-left: 15%">
            <div class="field">
              <input type="submit" class="input w50" style="width:10%; float:left;" id="put" value="提交"/>
              <div class="tips"></div>
            </div>
          </div>
          <script>
            $("#put").click(function() {
              var id = $("#id").val();
              var name = $("#name").val();
              var sex = $("#sex ").val();
              var age = $("#age").val();
              var studentclass = $("#studentclass").val();
              $.post(" /addStudents",{id:id+'',name:name,sex:0,age:18,studentclass:"1882072"},function (data) {
                if(data=="error"){
                  alert("学号重复,添加失败！");
                }else if(data=="OK"){
                  alert("添加成功！");
                }else{
                  alert("添加失败");
                }
              },"json");
            });
          </script>
        </div>
      </div>
    </div>
  </body>
</html>